#include "../Base.h"

NTSTATUS DeleteRegistryKey(PWCH keyPath)
{

	HANDLE hKeyNum = NULL;
	OBJECT_ATTRIBUTES enumObj = { 0 };
	UNICODE_STRING uEnumName;
	RtlInitUnicodeString(&uEnumName, keyPath);
	InitializeObjectAttributes(&enumObj, &uEnumName, OBJ_CASE_INSENSITIVE, NULL, NULL);
	NTSTATUS status = ZwOpenKey(&hKeyNum, KEY_ALL_ACCESS, &enumObj);
	if (!NT_SUCCESS(status)) {
		
		LOG("ZwOpenKey 失败\r\n");
		return status;
	}
	status = ZwDeleteKey(hKeyNum);
	if (!NT_SUCCESS(status)) {
		LOG("ZwDeleteKey 失败\r\n");
	}
	ZwClose(hKeyNum);
	return status;
}
